package com.guit.hrms.service.impl;

import com.guit.hrms.dto.Position.AddPositionDTO;
import com.guit.hrms.mapper.PositionMapper;
import com.guit.hrms.po.position.Position;
import com.guit.hrms.service.PositionService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PositionServiceImpl implements PositionService {

    @Autowired
    PositionMapper positionMapper;
    /**
     * 新增岗位
     * @param addPositionDTO
     */
    @Override
    public void addAcademy(AddPositionDTO addPositionDTO) {
        Position position =new Position();
        BeanUtils.copyProperties(addPositionDTO,position);
        positionMapper.addPosition(position);
    }

    /**
     * 更新岗位
     * @param position
     */
    @Override
    public void updateAcademy(Position position) {
        positionMapper.updateAcademyById(position);
    }

    /**
     * 批量删除岗位
     * @param positionIds
     */
    @Override
    public void deleteAcademy(List<Integer> positionIds) {
        for (Integer positionId : positionIds) {
            positionMapper.deleteAcademyById(positionId);
        }
    }
}
